#if 0
g++ -Wall -Wextra -std=c++03 -I/usr/local/include/tr1_fwd -o "$0.run" "$0"
exit
#endif

//#define CXXOMFORT_NOTICES 3
#include <cxxomfort/library/string.hpp>
#include <cxxomfort/string.hpp>
#include <iostream>
#include <iomanip>
#include <ctime> // time
#include <cstdlib>
#include <ciso646> // for some old compilers

int main () {
    using namespace std;
    //using std::to_string;
    //using cxxomfort::library::string::to_string; // variadic to_string
    namespace string2 = cxxomfort::library::string ;
    //using namespace cxxomfort::literals;

    cxxomfort::output_info(stdout);
    cout<< endl;

    cout<< "The following outputs should be: "<< endl;
    cout<< "1.- '15' via to_string(int): "<< endl;
    cout<< right<< setw(6)<< to_string(15)<< endl;
    cout<< "From now on we use variadic to_string:"<< endl;
    cout<< "2.- 'false' as we pass iomanips to to_string: "<< endl;
    cout<< string2::to_string(boolalpha, false)<< endl;
    cout<< "3.- '15.152000' or similar, via to_string(floating_point): "<< endl;
    cout<< to_string(15.152)<< endl;
    cout<< "4.- '003f' or similar, as we pass formatters to to_string: "<< endl;
    cout<< string2::to_string(setfill('0'), setw(4), hex, 0x3fU)<< endl;
    cout<< "4.- the same as above but we're using normal << : "<< endl;
    cout<< setfill('0') << setw(4)<< hex<< 0x3fU << endl;

    cout<< endl;
    cout<<
    "The output of the following section is the current system time, \n"
    "with a Daytime/Nighttime suffix and right-aligned at a 12-characters width.\n"<< endl;
    time_t tt(time(0));
    struct tm tmdata= *localtime(&tt);
    int hours = tmdata.tm_hour, minutes = tmdata.tm_min;
    bool daytime = (hours >= 7) and (hours<= 18);
    cout << right << setfill('_') << setw(12)
    << string2::to_string(hours, ':', setfill('0'), setw(2), minutes, " ", (daytime?"D":"N"))
    << endl;
    cout<< "123456789012345"<< endl;

}
